$folderPath = "D:\BaiduNetdiskDownload\haitao"
# $folderPath = "D:\workspace\2024\test\output\0721"

# 获取文件夹 A 下所有文件
$files = Get-ChildItem -Path $folderPath -File -Recurse

foreach ($file in $files) {
    if ($file.Extension -eq ".IMA") {
        $newFilePath = $file.FullName.Replace(".IMA", ".dcm")
        Rename-Item -Path $file.FullName -NewName $newFilePath
        Write-Output "Renamed file: $($file.FullName) to $($newFilePath)"
    }
}
